org.eclipse.vtp.framework.interactions.voice.vxml
Class Form

java.lang.Object
  extended by org.eclipse.vtp.framework.interactions.core.support.Widget
      extended by org.eclipse.vtp.framework.interactions.voice.vxml.Dialog
          extended by org.eclipse.vtp.framework.interactions.voice.vxml.Form
All Implemented Interfaces:
VXMLConstants

public class Form
extends Dialog

The Form class represents the <form> VXML element. A form can contain any number of Block and Field elements. The child elements are presented to the caller in the order they were added to the form.

Instead of handling filled events within each field of the form, filled handlers can be added to the form. This provides flexibility in the way a form is completed or progresses during processing.

Variables can be added at the form level. These variables are then accessable to all child elements and are a convenient way to pass data from one child to another.

Version:
2.0
Author:
Trip Gilman, Lonnie Pryor

Field Summary
 
Fields inherited from interface org.eclipse.vtp.framework.interactions.voice.vxml.VXMLConstants
EMPTY, FILE_EXT_GSL, FILLED_MODE_ALL, FILLED_MODE_ANY, GRAMMAR_MODE_DTMF, GRAMMAR_MODE_VOICE, METHOD_GET, METHOD_POST, MIME_TYPE_GSL, MIME_TYPE_SRGS, NAME_APPLICATION, NAME_ASSIGN, NAME_AUDIO, NAME_BARGEIN, NAME_BEEP, NAME_BLOCK, NAME_BRIDGE, NAME_CATCH, NAME_CHOICE, NAME_COMPLETETIMEOUT, NAME_COND, NAME_CONFIDENCELEVEL, NAME_COUNT, NAME_DEST, NAME_DISCONNECT, NAME_DTMF, NAME_DTMFTERM, NAME_ELSE, NAME_ELSEIF, NAME_ENCTYPE, NAME_ENUMERATE, NAME_ERROR, NAME_EVENT, NAME_EVENTEXPR, NAME_EXIT, NAME_EXPR, NAME_FIELD, NAME_FILLED, NAME_FINALSILENCE, NAME_FORM, NAME_GOTO, NAME_GRAMMAR, NAME_ID, NAME_IF, NAME_INCOMPLETETIMEOUT, NAME_INPUTMODES, NAME_INTERDIGITTIMEOUT, NAME_ITEM, NAME_MAXNBEST, NAME_MAXSPEECHTIMEOUT, NAME_MAXTIME, NAME_MENU, NAME_METHOD, NAME_MODE, NAME_NAME, NAME_NAMELIST, NAME_NEXT, NAME_NOINPUT, NAME_NOMATCH, NAME_ONE_OF, NAME_OPTION, NAME_PARAM, NAME_PROMPT, NAME_PROPERTY, NAME_RECORD, NAME_REPEAT, NAME_REPROMPT, NAME_RETURN, NAME_ROOT, NAME_RULE, NAME_SCOPE, NAME_SCRIPT, NAME_SENSITIVITY, NAME_SPEEDVSACCURACY, NAME_SRC, NAME_SUBDIALOG, NAME_SUBMIT, NAME_TERMCHAR, NAME_TERMTIMEOUT, NAME_THROW, NAME_TIMEOUT, NAME_TRANSFER, NAME_TYPE, NAME_VALUE, NAME_VAR, NAME_VERSION, NAME_VXML, NAMESPACE_URI_VXML, QNAME_XML_LANG, SCOPE_DIALOG, SCOPE_DOCUMENT, TYPE_CDATA, VERSION_2_0
 
Constructor Summary
Form(java.lang.String id)
          Creates a new instance of Form with the specified identifier.
Form(java.lang.String id, java.lang.String scope)
          Creates a new instance of Form with the specified identifier and scope.
 
Method Summary
 void addFilledHandler(Filled filled)
          Adds the specified filled handler to this form.
 void addFormElement(FormElement formElement)
          Adds the specified form element to this form.
 void addVariable(Variable variable)
          Adds the specified variable element to this form.
 void removeFilledHandler(Filled filled)
          Removes the specified filled handler from this form.
 void removeFormElement(FormElement formElement)
          Removes the specified form element from this form.
 void removeVariable(Variable variable)
          Removes the specified variable element from this form.
protected  void writeFilledHandlers(org.xml.sax.ContentHandler outputHandler)
          Write the filled handlers in this form to the specified content handler.
protected  void writeFormElements(org.xml.sax.ContentHandler outputHandler)
          Write the elements in this form to the specified content handler.
protected  void writeVariables(org.xml.sax.ContentHandler outputHandler)
          Write the variables in this form to the specified content handler.
 void writeWidget(org.xml.sax.ContentHandler outputHandler)
          Writes the content of this widget to an XML content handler.
 
Methods inherited from class org.eclipse.vtp.framework.interactions.voice.vxml.Dialog
addEventHandler, clearProperty, getID, getPropertyNames, getPropertyValue, getScope, removeEventHandler, setID, setProperty, setScope, writeAttributes, writeEventHandlers, writeProperties
 
Methods inherited from class org.eclipse.vtp.framework.interactions.core.support.Widget
toString, writeAttribute, writeChildren, writeChildren, writeWidget, writeWidget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Form

public Form(java.lang.String id)
     throws java.lang.IllegalArgumentException,
            java.lang.NullPointerException
Creates a new instance of Form with the specified identifier. The sets of form elements, variables, and filled handlers are initially empty.

Parameters:
id - See documentation of the Dialog element.
Throws:
java.lang.IllegalArgumentException - If the supplied ID is empty.
java.lang.NullPointerException - If the supplied ID is null.

Form

public Form(java.lang.String id,
            java.lang.String scope)
     throws java.lang.IllegalArgumentException,
            java.lang.NullPointerException
Creates a new instance of Form with the specified identifier and scope. The sets of form elements, variables, and filled handlers are initially empty.

Parameters:
id - See documentation of the Dialog element.
scope - See documentation of the Dialog element.
Throws:
java.lang.IllegalArgumentException - If the supplied ID is empty.
java.lang.IllegalArgumentException - If the supplied scope is invalid.
java.lang.NullPointerException - If the supplied ID is null.
java.lang.NullPointerException - If the supplied scope is null.
Method Detail

addVariable

public void addVariable(Variable variable)
                 throws java.lang.NullPointerException
Adds the specified variable element to this form. Variables declared at the form level are accessible to all child elements.

Parameters:
variable - The variable to add.
Throws:
java.lang.NullPointerException - If the supplied variable is null.

removeVariable

public void removeVariable(Variable variable)
                    throws java.lang.NullPointerException
Removes the specified variable element from this form.

Parameters:
variable - The variable to remove.
Throws:
java.lang.NullPointerException - If the supplied variable is null.

addFormElement

public void addFormElement(FormElement formElement)
                    throws java.lang.NullPointerException
Adds the specified form element to this form. Form elements will be processed in the order they were added.

Parameters:
formElement - The form element to add.
Throws:
java.lang.NullPointerException - If the supplied element is null.

removeFormElement

public void removeFormElement(FormElement formElement)
                       throws java.lang.NullPointerException
Removes the specified form element from this form.

Parameters:
formElement - The form element to remove.
Throws:
java.lang.NullPointerException - If the supplied element is null.

addFilledHandler

public void addFilledHandler(Filled filled)
                      throws java.lang.NullPointerException
Adds the specified filled handler to this form. Filled handlers at the form level are processed when some or all of the form's child elements are set, depending on the mode of the handler. Filled handlers are executed in the order they were added.

Parameters:
filled - The filled handler to add.
Throws:
java.lang.NullPointerException - If the supplied filled handler is null.

removeFilledHandler

public void removeFilledHandler(Filled filled)
                         throws java.lang.NullPointerException
Removes the specified filled handler from this form.

Parameters:
filled - The filled handler to remove.
Throws:
java.lang.NullPointerException - If the supplied filled handler is null.

writeWidget

public void writeWidget(org.xml.sax.ContentHandler outputHandler)
                 throws java.lang.NullPointerException,
                        org.xml.sax.SAXException
Description copied from class: Widget
Writes the content of this widget to an XML content handler.

Specified by:
writeWidget in class Widget
Parameters:
outputHandler - The handler to write this widget to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of this widget fails.

writeVariables

protected void writeVariables(org.xml.sax.ContentHandler outputHandler)
                       throws java.lang.NullPointerException,
                              org.xml.sax.SAXException
Write the variables in this form to the specified content handler.

Parameters:
outputHandler - The content handler to write to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of one of the variables fails.

writeFormElements

protected void writeFormElements(org.xml.sax.ContentHandler outputHandler)
                          throws java.lang.NullPointerException,
                                 org.xml.sax.SAXException
Write the elements in this form to the specified content handler.

Parameters:
outputHandler - The content handler to write to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of one of the elements fails.

writeFilledHandlers

protected void writeFilledHandlers(org.xml.sax.ContentHandler outputHandler)
                            throws java.lang.NullPointerException,
                                   org.xml.sax.SAXException
Write the filled handlers in this form to the specified content handler.

Parameters:
outputHandler - The content handler to write to.
Throws:
java.lang.NullPointerException - If the supplied content handler is null.
org.xml.sax.SAXException - If the writing of one of the filled handlers fails.